//
//  ShopIndexTableViewCell.m
//  FaceTo
//
//  Created by chijia on 2017/7/7.
//  Copyright © 2017年 chengbangming. All rights reserved.
//

#import "ShopIndexTableViewCell.h"

@implementation ShopIndexTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initUI];
    }
    return self;
}
- (void)initUI{
    _bjImage = [[UIImageView alloc]init];
    _bjImage.image = [UIImage imageNamed:@"guoqi"];
    [self addSubview:_bjImage];
    
    _ShopName = [[UILabel alloc]init];
    _ShopName.text = @"商家名称";
    _ShopName.font = LPFont(14);
    _ShopName.textColor = Color(51, 51, 51);
    _ShopName.textAlignment = NSTextAlignmentLeft;
    [self addSubview:_ShopName];
    
    _numberLabel = [[UILabel alloc]init];
    _numberLabel.text = @"共5件商品";
    _numberLabel.font = LPFont(12);
    _numberLabel.textAlignment = NSTextAlignmentLeft;
    _numberLabel.textColor = Color(220, 220, 220);
    [self addSubview:_numberLabel];
    
    _jianjie = [[UILabel alloc]init];
    _jianjie.text = @"商家介绍：商家介绍商家介绍";
    _jianjie.font = LPFont(13);
    _jianjie.textAlignment = NSTextAlignmentLeft;
    _jianjie.textColor = Color(220, 220, 220);
    [self addSubview:_jianjie];
    
    _addressLabel = [[UILabel alloc]init];
    _addressLabel.text = @"商家地址：江南大学北区商业街2楼1212号";
    _addressLabel.font = LPFont(13);
    _addressLabel.textAlignment = NSTextAlignmentLeft;
    _addressLabel.textColor = Color(220, 220, 220);
    [self addSubview:_addressLabel];
    
    [_bjImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(10);
        make.centerY.equalTo(self.mas_centerY);
        make.width.mas_equalTo(85);
        make.height.mas_equalTo(85);
    }];
    
    [_ShopName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_bjImage.mas_right).with.offset(15);
        make.top.equalTo(_bjImage.mas_top);
        make.height.mas_equalTo(14);
    }];
    
    [_numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_ShopName.mas_right).with.offset(10);
        make.bottom.equalTo(_ShopName.mas_bottom);
        make.height.mas_equalTo(12);
    }];
    
    [_jianjie mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_ShopName.mas_left);
        make.bottom.equalTo(_addressLabel.mas_top).with.offset(-5);
        make.height.mas_equalTo(13);
    }];
    
    [_addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(_bjImage.mas_bottom);
        make.left.equalTo(_ShopName.mas_left);
        make.height.mas_equalTo(13);
    }];
    
    
    
}
-(void)setModel:(ShopContent *)model{
    _model = model;
    [_bjImage sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",_model.shop_image]]];
    _ShopName.text = _model.shop_name;
    _addressLabel.text = [NSString stringWithFormat:@"商家地址：%@",_model.shop_address];
    _numberLabel.text = [NSString stringWithFormat:@"共%ld件商品",_model.goods_number];
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
